import type { PageParams, PageResult } from '@/types/global'
import { http } from '../utils/http'
import type { BannerItem, CategoryItem, GuessLikeItem, HotItem } from '@/types/home'
/**
 * 获取首页轮播图
 * @param distributionSite 广告区域展示位置
1 为首页（默认值）
2 为商品分类页
 * @returns 
 */
export const getHomeBannerAPI = (distributionSite = 1) => {
  return http<BannerItem[]>({
    method: 'GET',
    url: '/home/banner',
    data: {
      distributionSite,
    },
  })
}

/**
 * 获取前台分类
 */
export const getHomeCategoryAPI = () => {
  return http<CategoryItem[]>({
    method: 'GET',
    url: '/home/category/mutli',
  })
}

/**
 * 获取首页热门推荐商品
 */
export const getHomeHotAPI = () => {
  return http<HotItem[]>({
    method: 'GET',
    url: '/home/hot/mutli',
  })
}

/**
 * 获取首页猜你喜欢
 */
export const getHomeGuessLikeAPI = (data?: PageParams) => {
  return http<PageResult<GuessLikeItem>>({
    method: 'GET',
    url: '/home/goods/guessLike',
    data,
  })
}
